#include <windows.h>
#include <winioctl.h>
#include <sffdisk.h>
#include <sddef.h>
#include <sstream>
#include <iostream>

#ifndef __SDEXT_DEVICE__H
#define __SDEXT_DEVICE__H
const int SDCMD_SEND_CSD =  9;
class no_device_exception;
class no_volume_exception;
class  Device
{
public:
	Device(wchar_t device_number);
	BOOL IsSdCard();
	wchar_t* GetVolume(){return &_volume[0];}

private:
	struct cmd_buffer
	{
		char sdcd[sizeof(SFFDISK_DEVICE_COMMAND_DATA)];
		SDCMD_DESCRIPTOR desc;
		BYTE buffer[16];
	};
    void init();
    struct cmd_buffer _buffer;
	wchar_t _volume[MAX_PATH];
    HANDLE _handle;

};
class no_volume_exception
{
	std::wstring _info;
 public:
	 no_volume_exception(const std::wstring& info):_info(info){};
	 const wchar_t* what()const{
		 return _info.c_str();
	 }

};
class no_device_exception
{
	std::wstring _info;
 public:
	 no_device_exception(const std::wstring& info):_info(info){};
	 const wchar_t* what()const{
		 return _info.c_str();
	 }
};



    
    
            
#endif
